package com.tudouji.project.bill.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.tudouji.framework.aspectj.lang.annotation.Log;
import com.tudouji.framework.aspectj.lang.enums.BusinessType;
import com.tudouji.project.bill.domain.SellformOverdue;
import com.tudouji.project.bill.service.ISellformOverdueService;
import com.tudouji.framework.web.controller.BaseController;
import com.tudouji.framework.web.domain.AjaxResult;
import com.tudouji.common.utils.poi.ExcelUtil;
import com.tudouji.framework.web.page.TableDataInfo;

/**
 * 销售订单逾期信息Controller
 * 
 * @author tudouji
 * @date 2023-11-07
 */
@RestController
@RequestMapping("/sellform/overdue")
public class SellformOverdueController extends BaseController
{
    @Autowired
    private ISellformOverdueService sellformOverdueService;

    /**
     * 查询销售订单逾期信息列表
     */
    @GetMapping("/list")
    public TableDataInfo list(SellformOverdue sellformOverdue)
    {
        startPage();
        List<SellformOverdue> list = sellformOverdueService.selectSellformOverdueList(sellformOverdue);
        return getDataTable(list);
    }

    /**
     * 导出销售订单逾期信息列表
     */
    @Log(title = "销售订单逾期信息", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(SellformOverdue sellformOverdue)
    {
        List<SellformOverdue> list = sellformOverdueService.selectSellformOverdueList(sellformOverdue);
        ExcelUtil<SellformOverdue> util = new ExcelUtil<SellformOverdue>(SellformOverdue.class);
        return util.exportExcel(list, "overdue");
    }

    /**
     * 获取销售订单逾期信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('sellform:overdue:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(sellformOverdueService.selectSellformOverdueById(id));
    }

    /**
     * 新增销售订单逾期信息
     */
    @PreAuthorize("@ss.hasPermi('sellform:overdue:add')")
    @Log(title = "销售订单逾期信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SellformOverdue sellformOverdue)
    {
        return toAjax(sellformOverdueService.insertSellformOverdue(sellformOverdue));
    }

    /**
     * 修改销售订单逾期信息
     */
    @PreAuthorize("@ss.hasPermi('sellform:overdue:edit')")
    @Log(title = "销售订单逾期信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SellformOverdue sellformOverdue)
    {
        return toAjax(sellformOverdueService.updateSellformOverdue(sellformOverdue));
    }

    /**
     * 删除销售订单逾期信息
     */
    @PreAuthorize("@ss.hasPermi('sellform:overdue:remove')")
    @Log(title = "销售订单逾期信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(sellformOverdueService.deleteSellformOverdueByIds(ids));
    }
}
